Offload all prefetch operations to mount process for warm auth#2002
Draft
tyrielv wants to merge 3 commits into
Draft
Offload all prefetch operations to mount process for warm auth#2002tyrielv wants to merge 3 commits into
tyrielv wants to merge 3 commits into
Conversation
4fa1302 to
a5fb655
Compare
When a GVFS mount is running, 'gvfs prefetch --commits' now sends a PrefetchCommits request to the mount process via named pipe IPC. The mount process executes the prefetch using its already-warm authentication, avoiding the slow cold-auth path (anonymous probe + git credential helper invocation). If the mount is not running, not ready, or is an older version that does not recognize the PrefetchCommits message, the verb falls back to the existing direct-auth path transparently. Changes: - NamedPipeMessages: Add PrefetchCommits request/response messages - PrefetchStep: Add injectable post-fetch callback to avoid re-entrant named pipe IPC when running inside the mount process - InProcessMount: Add HandlePrefetchCommitsRequest handler that runs PrefetchStep synchronously on the connection thread - PrefetchVerb: Try mount offload before falling back to direct auth - Add PrefetchCommitsOffloadTests functional tests covering mounted, unmounted, idempotent, and remount scenarios Assisted-by: Claude Opus 4.6 Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
a5fb655 to
256710f
Compare
Extend the prefetch offload to handle blob prefetch (files/folders), not just commit/tree prefetch. When mounted, 'gvfs prefetch --files' and 'gvfs prefetch --folders' now offload to the mount process using its warm authentication. The noop check (IsNoopPrefetch via LastBlobPrefetch.dat) still runs client-side before attempting offload, so no IPC overhead for no-ops. Changes: - NamedPipeMessages: Add PrefetchBlobs request/response with file/folder lists, commit ID, hydrate flag, and stats in response - InProcessMount: Add HandlePrefetchBlobsRequest handler that creates a fresh GitObjectsHttpRequestor with warm auth, runs BlobPrefetcher with capped thread counts (ProcessorCount/2), validates inputs, and properly disposes HTTP resources - PrefetchVerb: Try blob offload after noop check, fall back to direct auth only when mount is unavailable - Add PrefetchBlobsOffloadTests functional tests covering mounted blobs, stats reporting, unmounted fallback, folder prefetch, and remount Assisted-by: Claude Opus 4.6 Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
Hydration writes to the ProjFS-virtualized working directory, which can trigger callbacks back into the mount process. Skip the offload path for --hydrate and use the direct-auth path instead, where the verb process handles hydration safely from outside the mount. Assisted-by: Claude Opus 4.6 Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a GVFS mount is running,
gvfs prefetch --commitsnow sends aPrefetchCommitsrequest to the mount process via named pipe IPC. The mount process executes the prefetch using its already-warm authentication, avoiding the slow cold-auth path (anonymous HTTP probe +git credentialhelper invocation).If the mount is not running, not ready, or is an older version that does not recognize the
PrefetchCommitsmessage, the verb falls back to the existing direct-auth path transparently.Motivation
Authentication for prefetch is always slow — the anonymous probe + credential helper invocation adds multiple seconds. The mount process already has warm auth from startup. By offloading to the mount, we skip this cold-auth cost entirely for the common case where the repo is mounted.
Changes
PrefetchCommitsrequest/response message typesHandlePrefetchCommitsRequesthandler that runsPrefetchStepsynchronously on the connection thread using the mount's warmGVFSGitObjectsMountNotReady, orUnknownRequestfrom old mount). Mount-side failures are surfaced directly — no fallback on real errors.Design Decisions
PrefetchStep.SchedulePostFetchJob()opening a named pipe back to the same mount (re-entrant IPC). The mount handler directly enqueuesPostFetchStepon its maintenance scheduler.Testing